# This toolchain builds Optware packages for Atheros AR71xx/AR7240/AR913x routers with OpenWRT
# Backfire or DD-WRT v24sp1 firmware using OpenWRT buildroot SDK for Linux 2.6.

LIBC_STYLE=uclibc
TARGET_ARCH=mips-openwrt
TARGET_OS=linux-uclibc

LIBSTDC++_VERSION=6.0.10
LIBNSL_VERSION=0.9.28

GETTEXT_NLS=enable
NO_BUILTIN_MATH=true

HOSTCC = gcc
GNU_HOST_NAME = $(HOST_MACHINE)-pc-linux-gnu
GNU_TARGET_NAME=$(TARGET_ARCH)-linux

CROSS_CONFIGURATION_GCC_VERSION=4.3.3+cs
CROSS_CONFIGURATION_UCLIBC_VERSION=0.9.30.1
BUILDROOT_GCC=$(CROSS_CONFIGURATION_GCC_VERSION)
UCLIBC-OPT_VERSION=$(CROSS_CONFIGURATION_UCLIBC_VERSION)

ifeq ($(HOST_MACHINE),mips)
HOSTCC = $(TARGET_CC)
GNU_HOST_NAME = $(HOST_MACHINE)-linux-gnu
GNU_TARGET_NAME=$(TARGET_ARCH)-linux
TARGET_CROSS=/opt/bin/
TARGET_LIBDIR=/opt/lib
TARGET_INCDIR=/opt/include
TARGET_LDFLAGS = -L/opt/lib
TARGET_CUSTOM_FLAGS=
TARGET_CFLAGS=-I/opt/include $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_CUSTOM_FLAGS)
toolchain:
else
CROSS_CONFIGURATION_GCC=gcc-$(CROSS_CONFIGURATION_GCC_VERSION)
CROSS_CONFIGURATION_UCLIBC=uClibc-$(CROSS_CONFIGURATION_UCLIBC_VERSION)
CROSS_CONFIGURATION=$(CROSS_CONFIGURATION_GCC)_$(CROSS_CONFIGURATION_UCLIBC)
TARGET_CROSS_TOP = $(shell cd $(BASE_DIR)/../..; pwd)/openwrt/staging_dir/toolchain-mips_r2_$(CROSS_CONFIGURATION)
TARGET_CROSS = $(TARGET_CROSS_TOP)/usr/bin/$(TARGET_ARCH)-$(TARGET_OS)-
TARGET_LIBDIR = $(TARGET_CROSS_TOP)/lib
TARGET_INCDIR = $(TARGET_CROSS_TOP)/include
TARGET_LDFLAGS =
TARGET_CUSTOM_FLAGS= -pipe
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_CUSTOM_FLAGS)
toolchain:
endif
